Skip to content

Dev#434

Merged
safe1ine merged 11 commits into
mainfrom
dev
Mar 23, 2026
Merged

Dev#434
safe1ine merged 11 commits into
mainfrom
dev

Conversation

@safe1ine
Copy link
Copy Markdown
Collaborator

No description provided.

- README: 去掉横幅与截图、社区与许可证长段,收敛为简介与文档入口
- task-detail: 移除聊天区域容器的 px-2 pb-2,与布局对齐

Made-with: Cursor
- 从 user-sidebar 移除 NavMain
- 删除仅含 Git 机器人链接的 nav-main 组件

Made-with: Cursor
在控制台与团队管理的绑定/修改模型对话框中,当 getProviderModelList 失败或返回空列表时,将模型名称由仅下拉改为可输入;修改 API 地址或 Token 时重置列表状态。绑定弹窗在每次打开时重置列表尝试状态。

Made-with: Cursor
- 定价区改为四档:基础版、专业版、团队版、离线版,补充积分与权益说明
- Banner 与 Highlights 文案与模型、版本策略对齐
- 离线版仅保留开源仓库入口,链接至 chaitin/MonkeyCode

Made-with: Cursor
- doc.md:按当前前端路由与交互更新说明,修正侧栏/顶栏、配置弹窗、Git 机器人入口等过时描述,补充项目自动 Review、任务列表分页等细节。
- public/ppt/index.html:改为理念与产品特色导向的宣讲稿,移除手册式路径与操作步骤。

Made-with: Cursor
Copy link
Copy Markdown

@monkeycode-ai monkeycode-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是 MonkeyCode AI 编程助手,你可以在 GitHub 仓库的 PR 中 at @MonkeyCode-AI 来呼唤我。

任务执行细节请参考: https://monkeycode-ai.com/tasks/public?id=90f8245b-3cd5-4496-86f0-bce2dc011550

代码审查结果

发现 4 个问题:0 严重,3 警告,1 建议

  1. 整体实现完整,但存在一个跨平台打包失败风险与一个外链安全缺口。
  2. 整体改动方向正确,但存在跨平台脚本与产物忽略遗漏问题。
  3. 本组改动整体合理,模型拉取失败兜底与状态重置设计完善。
  4. 本组改动整体质量良好,文案重构与定价结构调整实现清晰且无明显缺陷。
  5. 文档整体更新详实,但帮助文档链接与仓库现状不一致。

✨ 代码亮点

  • 通过 requestSingleInstanceLock + second-instance 聚焦窗口,避免多实例冲突。
  • ensureWindowVisible 同时监听 ready-to-show / did-finish-load 并设置兜底超时,降低白屏或“未启动”错觉。
  • Release workflow 将构建与发布拆分为多作业,并在非 tag 场景自动跳过正式发布,流程边界清晰。
🚨 Critical ⚠️ Warning 💡 Suggestion
0 3 1

Comment thread README.md
- 如果你通过网络提供服务,也必须开源你的代码
- 商业使用需要遵守相同的开源要求
- 官网:https://monkeycode-ai.com
- 帮助文档:https://monkeycode-ai.com/docs
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ 帮助文档链接与项目内现有链接体系不一致

README 将帮助文档地址改为 https://monkeycode-ai.com/docs,但当前前端代码中仍大量使用 https://monkeycode.docs.baizhi.cloud/ 作为帮助文档入口(包括用户控制台、管理后台、欢迎页等)。这会导致用户从不同入口进入不同文档站点,增加维护和使用成本。

建议: 建议统一文档域名:要么同步更新前端所有帮助入口到新域名,要么在本次 README 中保持与现有产品入口一致,避免文档入口分裂。

Suggested change
- 帮助文档:https://monkeycode-ai.com/docs
- 帮助文档:https://monkeycode.docs.baizhi.cloud/

Comment thread frontend/package.json
"api": "sta --path ${SWAGGER} --output src/api"
"api": "sta --path ${SWAGGER} --output src/api",
"electron:dev": "concurrently -k \"vite\" \"wait-on http://localhost:5173 && electron .\"",
"electron:build:dist": "ELECTRON=true pnpm build",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ electron:build:dist 脚本使用了非跨平台环境变量写法

"electron:build:dist": "ELECTRON=true pnpm build" 在 Unix Shell 可用,但在 Windows 默认 npm/pnpm 脚本环境(cmd)下会失效,导致该脚本无法执行。这会影响在 Windows 上进行本地 Electron dist 构建的可用性。

建议: 改为跨平台写法(如使用 cross-env),并补充对应依赖,避免不同系统下行为不一致。

Comment on lines +32 to +35
const z = spawnSync("zip", ["-rq", zipName, "win-unpacked"], {
stdio: "inherit",
cwd: releaseDir,
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ Windows 打包脚本依赖 zip 命令,原生 Windows 环境可能直接失败

pack-win.mjs 默认分支里直接调用 zip 可执行文件压缩 win-unpacked。该命令在 WSL/macOS/Linux 常见,但在原生 Windows(PowerShell/CMD)通常不存在,导致 electron:pack:win 在本机 Windows 场景失败。文件名和脚本语义都指向 Windows 打包,这会影响可用性。

建议: 对压缩步骤按平台分支:Windows 使用 powershell Compress-Archive,非 Windows 继续使用 zip,避免对外部 Unix 命令的硬依赖。

Suggested change
const z = spawnSync("zip", ["-rq", zipName, "win-unpacked"], {
stdio: "inherit",
cwd: releaseDir,
})
const zipCmd = process.platform === "win32" ? "powershell" : "zip"
const zipArgs =
process.platform === "win32"
? [
"-NoProfile",
"-Command",
`Compress-Archive -Path \"win-unpacked\\*\" -DestinationPath \"${zipName}\" -Force`,
]
: ["-rq", zipName, "win-unpacked"]
const z = spawnSync(zipCmd, zipArgs, {
stdio: "inherit",
cwd: releaseDir,
})

Comment thread .gitignore
.pnpm-store/

# Electron (electron-builder)
frontend/release/
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

💡 未忽略 release-full 目录,可能提交 Electron 全量打包产物

当前仅忽略了 frontend/release/,但项目同时存在 electron-builder.full.json 输出目录 release-full。执行 electron:pack:with-dist 后会生成 frontend/release-full/,该目录目前未被忽略,容易误提交大体积构建产物。

建议: 在 .gitignore 中补充忽略 frontend/release-full/,与现有 Electron 打包目录策略保持一致。

Suggested change
frontend/release/
# Electron (electron-builder)
frontend/release/
frontend/release-full/

Copy link
Copy Markdown

@monkeycode-ai monkeycode-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是 MonkeyCode AI 编程助手,你可以在 GitHub 仓库的 PR 中 at @MonkeyCode-AI 来呼唤我。

任务执行细节请参考: https://monkeycode-ai.com/tasks/public?id=a06e13b3-99af-4747-abe8-340583769d77

代码审查结果

发现 2 个问题:0 严重,2 警告,0 建议

  1. 整体实现完整,但存在外链协议校验缺失与版本号兼容漏洞。
  2. 整体实现较完整,但手动模式下缺少重试入口影响可用性。
  3. 本组变更聚焦导航精简,未发现功能或编译风险。
  4. 本组改动整体稳健,文案与定价结构升级清晰且实现正确。
  5. 本组变更整体合理,Electron 构建链路配置完整且无明显缺陷。
  6. 本分片以文档与展示优化为主,未见明确功能性缺陷。

✨ 代码亮点

  • 通过 requestSingleInstanceLocksecond-instance 事件实现单实例聚焦,桌面端体验设计到位。
  • ensureWindowVisible 同时监听 ready-to-showdid-finish-load 并加超时兜底,减少白屏/无窗口误判。
  • 发布工作流将构建与发布拆分为多 job,并用 tag 条件控制 Release 创建,流程清晰且可复用。
🚨 Critical ⚠️ Warning 💡 Suggestion
0 2 0

Comment on lines +51 to +53
if [[ "$V" =~ ^[0-9]+\.[0-9]+$ ]]; then
V="${V}.0"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ Tag 仅含主版本号时会生成非法 semver

工作流声明 electron-builder 需要严格 semver,但当前仅处理了 major.minor 补丁补全,未处理 major(如 v1)场景。若打 v1 这类 tag,会把版本写成 1,可能导致构建失败。macOS 任务中同样存在相同逻辑(第 101 行附近)。

建议: 同时补全 majormajor.minor 两类版本格式,确保始终写入三段式 semver。

Suggested change
if [[ "$V" =~ ^[0-9]+\.[0-9]+$ ]]; then
V="${V}.0"
fi
if [[ "$V" =~ ^[0-9]+$ ]]; then
V="${V}.0.0"
elif [[ "$V" =~ ^[0-9]+\.[0-9]+$ ]]; then
V="${V}.0"
fi

Comment on lines +49 to +52
win.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url)
return { action: "deny" }
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ 外部链接未做协议白名单校验,存在安全风险

当前 setWindowOpenHandler 对任意 URL 直接调用 shell.openExternal(url)。在加载远程页面的 Electron 场景下,这会放大被恶意页面诱导打开危险协议(如 file:javascript:、自定义协议)的风险。应只允许明确的安全协议(通常是 http/https)。

建议: 在打开外链前解析 URL 并做协议白名单校验;不在白名单中的协议直接拒绝。

Suggested change
win.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url)
return { action: "deny" }
})
win.webContents.setWindowOpenHandler(({ url }) => {
try {
const u = new URL(url)
if (u.protocol === "http:" || u.protocol === "https:") {
shell.openExternal(url)
}
} catch {}
return { action: "deny" }
})

@safe1ine safe1ine merged commit 0c78e0d into main Mar 23, 2026
6 checks passed
Copy link
Copy Markdown

@monkeycode-ai monkeycode-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是 MonkeyCode AI 编程助手,你可以在 GitHub 仓库的 PR 中 at @MonkeyCode-AI 来呼唤我。

任务执行细节请参考: https://monkeycode-ai.com/tasks/public?id=c7afcd16-bb1d-4916-bd23-4a3a6f5e9558

代码审查结果

发现 4 个问题:0 严重,3 警告,1 建议

  1. 整体实现完整,但存在可被利用的外链打开安全风险。
  2. 整体改动清晰,但存在一处跨平台脚本兼容性问题。
  3. 改动方向正确,模型选择回退逻辑完善,未见明显缺陷。
  4. 侧边栏重构干净,但移除了 Git 机器人唯一可见入口。
  5. 本组改动以文案与展示重构为主,未发现明显功能性问题。
  6. 本组改动整体合理,文档与页面细节同步准确,无阻断问题。

✨ 代码亮点

  • 通过 requestSingleInstanceLock + second-instance 聚焦窗口,避免多开冲突
  • 使用 ready-to-show / did-finish-load / timeout 三重兜底提升首屏可见性稳定性
  • CI 中按 tag/手动触发动态注入 semver 版本,兼顾发布与试打场景
🚨 Critical ⚠️ Warning 💡 Suggestion
0 3 1

Comment on lines +67 to +69
win.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url)
return { action: "deny" }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ 未校验外链协议即调用 shell.openExternal

当前 setWindowOpenHandler 对任意 URL 直接执行 shell.openExternal(url)。在加载远程站点的 Electron 壳中,这会放大 XSS/恶意跳转影响,可能触发系统级协议处理(如非 http/https 自定义协议),属于 Electron 官方安全基线中应避免的模式。

建议: 在打开外链前校验协议(至少限制为 https/http),并对非法链接直接拒绝或记录日志。

Suggested change
win.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url)
return { action: "deny" }
win.webContents.setWindowOpenHandler(({ url }) => {
try {
const u = new URL(url)
if (u.protocol === "https:" || u.protocol === "http:") {
shell.openExternal(u.toString())
}
} catch (_) {
// ignore invalid url
}
return { action: "deny" }
})

Comment thread frontend/package.json
"api": "sta --path ${SWAGGER} --output src/api"
"api": "sta --path ${SWAGGER} --output src/api",
"electron:dev": "concurrently -k \"vite\" \"wait-on http://localhost:5173 && electron .\"",
"electron:build:dist": "ELECTRON=true pnpm build",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ electron:build:dist 的环境变量写法不兼容 Windows

"ELECTRON=true pnpm build" 是 POSIX Shell 写法,在 Windows 的 cmd/PowerShell 中不能直接生效,导致该脚本在 Windows 环境下执行失败或 ELECTRON 变量未注入。这会影响需要在 Windows 侧构建本地 dist 的流程一致性。

建议: 改为跨平台写法(例如使用 cross-env),并补充对应依赖,保证不同系统行为一致。

Suggested change
"electron:build:dist": "ELECTRON=true pnpm build",
"electron:build:dist": "cross-env ELECTRON=true pnpm build",

</SidebarHeader>
<SidebarContent>
<NavMain />
<NavProject />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

⚠️ 删除 NavMain 后缺少 /console/gitbot 的可发现入口

本次改动移除了 <NavMain />,而项目中未发现其他侧边栏或主导航链接指向 /console/gitbot。虽然路由仍存在并可手动输入 URL 访问,但这会导致“代码审查/Git 机器人”功能在常规 UI 流程中不可发现,属于功能可用性回退。

建议: 建议在 UserSidebar 中保留一个明确的导航项(例如“代码审查”)或将该入口并入 NavProject,确保用户可通过界面访问 /console/gitbot,而不是依赖手动输入地址。

Comment on lines +32 to +35
const z = spawnSync("zip", ["-rq", zipName, "win-unpacked"], {
stdio: "inherit",
cwd: releaseDir,
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

💡 默认压缩流程依赖 zip 命令,Windows 原生环境易失败

pack-win.mjs 在默认分支调用 zip 可执行文件压缩产物。该命令在 Windows 原生环境通常不存在(除非额外安装 Git Bash/WSL/第三方工具),会导致默认打包脚本在“Windows 打包”场景下失败。

建议: 增加跨平台压缩分支:Windows 使用 PowerShell Compress-Archive,其他平台继续使用 zip。

Suggested change
const z = spawnSync("zip", ["-rq", zipName, "win-unpacked"], {
stdio: "inherit",
cwd: releaseDir,
})
const zipCmd = process.platform === "win32" ? "powershell" : "zip"
const zipArgs =
process.platform === "win32"
? ["-NoProfile", "-Command", `Compress-Archive -Path 'win-unpacked\\*' -DestinationPath '${zipName}' -Force`]
: ["-rq", zipName, "win-unpacked"]
const z = spawnSync(zipCmd, zipArgs, {
stdio: "inherit",
cwd: releaseDir,
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant